﻿using ShopFine.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ShopFine
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadFeatured();
                LoadFeaturedVertical();
            }
        }

        private void LoadFeaturedVertical()
        {
            var featureds = new ProductDAO().GetFeaturedList().Take(4).ToList();
            UcFeaturedScroll.FeaturedList = featureds;
            UcFeaturedScroll.LoadFeaturedList();
        }

        private void LoadFeatured()
        {
            var featureds = new ProductDAO().GetFeaturedList().OrderByDescending(p=>p.CreateDate).Take(8);
            DataList1.DataSource = featureds;
            DataList1.DataBind();
        }
    }
}